﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ControllerStudy2.Controllers
{
    public class BonusController : Controller
    {
        //
        // GET: /Bonus/
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult TinhTienThuong()
        {
            String v1 = Request["luong"];
            String v2 = Request["ngaysinh"];

            double luong = Double.Parse(v1);
            DateTime ngaysinh = Convert.ToDateTime(v2);

            int tuoi = DateTime.Now.Year - ngaysinh.Year;

            if (tuoi < 25)
            {
                ViewBag.Thuong = luong * 0.05;
            }
            else if (tuoi < 40)
            {
                ViewBag.Thuong = luong * 0.1;
            }
            else
            {
                ViewBag.Thuong = luong * 0.15;
            }

            return View("Index");
        }
	}
}